package com.cn.action;

import com.cn.dao.DepartmentDao;
import com.cn.dao.DoctorDao;
import com.cn.dao.TiJianXiangmuDao;
import com.cn.entity.Department;
import com.cn.entity.Doctor;
import com.cn.entity.TiJianxiangmu;
import com.opensymphony.xwork2.Action;

public class XiangmuAddAction implements Action{


	String departmentname;
	TiJianxiangmu xiangmu;
	
	
	

	
	
	public TiJianxiangmu getXiangmu() {
		return xiangmu;
	}

	public void setXiangmu(TiJianxiangmu xiangmu) {
		this.xiangmu = xiangmu;
	}

	public String getDepartmentname() {
		return departmentname;
	}

	public void setDepartmentname(String departmentname) {
		this.departmentname = departmentname;
	}

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		System.out.println(departmentname);
		DepartmentDao ded=new DepartmentDao();
		Department department=ded.scanOne(departmentname);
		xiangmu.setDepartment(department);
		TiJianXiangmuDao xmd=new TiJianXiangmuDao();
		xmd.add(xiangmu);
		
		
		return "success";
	}
	
	
	
	
	
}
